//
//  MYGMeAPI.swift
//  MYDoctor
//
//  Created by Denny on 2024/4/2.
//

import UIKit
import Foundation
import Moya

enum MYGMeAPI:MYGTargetType {
    /**云盘相关*/
    case netDiskFolder(param: [String: Any])//网盘列表
    case addNetDiskFolder(param: [String: Any])//新建文件夹
    case editNetDiskFolder(param: [String: Any],id:String)//修改文件夹
    case deleteNetDiskFolder(id: String)//删除文件夹
    case netdiskLogDelete(id: String)//删除文件
    case netdiskDownload(param: [String: Any])//下载文件夹下所有内容
    case netdiskLogAdd(param: [String: Any])//添加上传下载日志
    case myFriendsList(param: [String: Any])//我的好友、粉丝、关注列表
    case myFriends(param: [String: Any])//我的好友
    case microStatistics//好友，关注.粉丝
    case myCollectList(param: [String: Any])//我的收藏 && 我的点赞
    case myLikes(param: [String: Any])// 我的点赞
    case articleList(param: [String: Any])//报道列表
    case articleNewsFromList(param: [String: Any])//全部的来源统计分组
    case deleteArticle(param: [String: Any])//删除我的报道
    case addArticle(param: [String: Any])//加入我的报道
    case articlelDetail(param: [String: Any])//报道详情
    case articleNewsDoctor(param: [String: Any])//抓取报道
    case articleTopicList(param: [String: Any])//话题列表
    case likeSubmit(param: [String: Any])//公共点赞
    case topicDetails(param: [String: Any])//话题详情
    case commentSubmit(param: [String: Any])//发表评论
    case topicCommentList(param: [String: Any])//话题评论列表
    case commentLike(param: [String: Any])//给评论点赞
    case addTopic(param: [String: Any])//添加话题
    case collectSubmit(param: [String: Any])//收藏话题
    case commentCommentList(param: [String: Any])//评论列表
    case netdiskSharingUser//共享用户列表
    case netdiskSharingExit(param: [String: Any])//退出共享
    case netdiskSharingLink//获取分享链接
    case sharePatient(param: [String: Any])//分享患者
    case imMyFriendsList(param: [String: Any])//我的好友
    case doctorAllList//获取所有医生
    case shareCode(param: [String: Any])//分享code
}
extension MYGMeAPI {
    var path: String {
        switch self {
        case .shareCode:
            return  "/api/netdisk/share/code"
        case .doctorAllList:
            return "/api/doctor/doctor_all_list"
        case .addArticle:
            return "/api/article/article_news_adds"
        case .deleteArticle:
            return "/api/article/article_news_dels"
        case .articleNewsFromList:
            return "/api/article/article_news_from_list"
        case .imMyFriendsList:
            return "/api/im/my_friends_list"
        case .netdiskSharingLink:
            return "/api/netdisk/sharingLink"
        case .netdiskSharingExit:
            return "/api/netdisk/sharing/exit"
        case .microStatistics:
            return "/api/micro/statistics"
        case .netdiskSharingUser:
            return "/api/netdisk/sharing/user"
        case .netdiskDownload:
            return "/api/netdisk/download"
        case .netdiskLogDelete(let id):
           return "/api/netdisk/log/delete/" + "\(id)"
        case .netdiskLogAdd:
            return "/api/netdisk/log/add"
        case .commentCommentList:
            return "/api/comment/comment_list"
        case .collectSubmit:
            return "/api/collect/submit"
        case .addTopic:
            return "/api/article/topic_store"
        case .topicDetails:
            return "/article-topic/details"
        case .likeSubmit:
            return "/api/like/submit"
        case .netDiskFolder:
            return "/api/netdisk/folder"
        case .addNetDiskFolder:
            return "/api/netdisk/folder"
        case .editNetDiskFolder(_,let id):
            return "/api/netdisk/folder/\(id)"
        case .deleteNetDiskFolder(let id):
            return "/api/netdisk/folder/\(id)"
        case .myFriendsList:
            return "/api/im/my_friends_list"
        case .myFriends:
            return "/api/im/my_friends"
        case .myLikes:
            return "/api/article/favorites_Like"
        case .myCollectList:
            return "/api/collect/my_list"
        case .articleList:
            return "/api/article/article_news_list"
        case .articlelDetail:
            return "/api/article/article_news_detail"
        case .articleNewsDoctor:
            return "/api/article/news_doctor"
        case .articleTopicList:
            return "/article-topic/list"
        case .commentSubmit:
            return "/api/comment/submit"
        case .topicCommentList:
            return "/api/article/topic_comment"
        case .commentLike:
            return "/api/comment/like"
        case .sharePatient:
            return "/api/referral/share"
        }
        
    }
    
    var method: Moya.Method {
        switch self {
        case
                .addTopic,.topicDetails,.commentLike,.likeSubmit,.netDiskFolder,.myFriendsList,.articleList,.articlelDetail,.articleNewsDoctor,.articleTopicList,.topicCommentList,.commentCommentList,.netdiskDownload,.netdiskSharingUser,.deleteArticle,.netdiskSharingExit,.netdiskSharingLink,.myFriends,.imMyFriendsList,.addArticle,.articleNewsFromList,.doctorAllList,.shareCode:
            return .get
        case .addNetDiskFolder,.myCollectList,.commentSubmit,.collectSubmit,.netdiskLogAdd,.microStatistics,.myLikes,.sharePatient:
            return .post
        case .editNetDiskFolder:
            return .put
        case .deleteNetDiskFolder,.netdiskLogDelete:
            return .delete
        }
    }

    var baseURL: URL {
        switch self {
        case 
                .articleNewsDoctor,
                .myCollectList,
                .commentSubmit,
                .likeSubmit,
                .commentLike,
                .topicCommentList,
                .editNetDiskFolder,
                .addNetDiskFolder,
                .myFriendsList,
                .addTopic,
                .netdiskLogAdd,
                .commentCommentList,
                .collectSubmit,
                .deleteNetDiskFolder,
                .netdiskLogDelete,
                .netdiskDownload,
                .microStatistics,
                .myFriends,
                .netdiskSharingExit,
                .netdiskSharingUser,
                .netdiskSharingLink,
                .myLikes,
                .sharePatient,
                .imMyFriendsList,
                .articleList,
                .deleteArticle,
                .addArticle,
                .articlelDetail,
                .articleNewsFromList,
                .doctorAllList,
                .shareCode,
                .netDiskFolder:
            return  URL(string: BaseUrl)!
        case
               
              
                .articleTopicList,
                .topicDetails:
            return  URL(string: Url)!
        }
    }
    var params: [String : Any] {
        switch self {
        case .netDiskFolder(param: let param),
                .shareCode(param: let param),
                .netdiskLogAdd(param: let param),
                .netdiskDownload(param: let param),
                .collectSubmit(param: let param),
                .commentLike(param: let param),
                .articleList(param: let param),
                .commentCommentList(param: let param),
                .addTopic(param: let param),
                .topicCommentList(param: let param),
                .likeSubmit(param: let param),
                .topicDetails(param: let param),
                .commentSubmit(param: let param),
                .articleTopicList(param: let param),
                .articlelDetail(param: let param),
                .addNetDiskFolder(param: let param),
                .myFriends(param: let param),
                .articleNewsDoctor(param: let param),
                .myFriendsList(param: let param),
                .myCollectList(param: let param),
                .netdiskSharingExit(param: let param),
                .myLikes(param: let param),
                .sharePatient(param: let param),
                .imMyFriendsList(param: let param),
                .deleteArticle(param: let param),
                .addArticle(param: let param),
                .articleNewsFromList(param: let param),
                .editNetDiskFolder(param: let param,_):
            return param
        case .deleteNetDiskFolder(_),.netdiskLogDelete(_),.netdiskSharingUser,.microStatistics,.netdiskSharingLink,.doctorAllList:
           return ["":""]
        }
    }
}

